package rentcar.repository.impl;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;
//import org.springframework.transaction.annotation.Transactional;

import rentcar.domain.Car;
import rentcar.repository.CarDao;
import rentcar.repository.base.AbstractHibernateDao;

@Repository
public class CarRepository extends AbstractHibernateDao<Car, Long> implements CarDao {

	@Override
	public Car findById(Long carId) {
		Criteria cr = getSession()
				.createCriteria(Car.class, "car")
				.add(Restrictions.eq("id", carId));
		return (Car) cr.uniqueResult();
	}	
	
	
	
}
